home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 May / EnigmA AMIGA RUN 18 (1997)(G.R. Edizioni)(IT)[!][issue 1997-05][EAR-CD II].iso / softwareupdate / system / amigados / filefunctions / example3.c < prev    next >
C/C++ Source or Header  |  1996-10-10  |  2KB  |  84 lines

  1. /***********************************************************/
  2. /*                                                         */
  3. /* Amiga C Encyclopedia (ACE)           Amiga C Club (ACC) */
  4. /* --------------------------           ------------------ */
  5. /*                                                         */
  6. /* Manual:  AmigaDOS                    Amiga C Club       */
  7. /* Chapter: File Functions              Tulevagen 22       */
  8. /* File:    Example3.c                  181 41  LIDINGO    */
  9. /* Author:  Anders Bjerin               SWEDEN             */
  10. /* Date:    93-03-15                                       */
  11. /* Version: 1.0                                            */
  12. /*                                                         */
  13. /*   Copyright 1993, Anders Bjerin - Amiga C Club (ACC)    */
  14. /*                                                         */
  15. /* Registered members may use this program freely in their */
  16. /*     own commercial/noncommercial programs/articles.     */
  17. /*                                                         */
  18. /***********************************************************/
  19.  
  20. /* This example demonstrates how to delete files and        */
  21. /* directories. It will delete the file and directory which */
  22. /* we renamed in the previous example.                      */
  23.  
  24.  
  25.  
  26.  
  27. /* Include the dos library definitions: */
  28. #include <dos/dos.h>
  29.  
  30. /* Now we include the necessary function prototype files:         */
  31. #include <clib/dos_protos.h>       /* General dos functions...    */
  32. #include <stdio.h>                 /* Std functions [printf()...] */
  33. #include <stdlib.h>                /* Std functions [exit()...]   */
  34.  
  35.  
  36.  
  37. /* Set name and version number: */
  38. UBYTE *version = "$VER: AmigaDOS/FileFunctions/Example3 1.0";
  39.  
  40.  
  41.  
  42. /* Declared our own function(s): */
  43.  
  44. /* Our main function: */
  45. int main( int argc, char *argv[] );
  46.  
  47.  
  48.  
  49. /* Main function: */
  50.  
  51. int main( int argc, char *argv[] )
  52. {
  53.   /* A simple boolean variable: */
  54.   BOOL ok;
  55.  
  56.  
  57.  
  58.   /* Delete the file: */
  59.   ok = DeleteFile( "RAM:Numbers.dat" );
  60.  
  61.   /* Check if the file was deleted or not: */
  62.   if( ok )
  63.     printf( "File deleted!\n" );
  64.   else
  65.     printf( "Error! Could not delete the file!\n" );
  66.  
  67.  
  68.  
  69.   /* Delete the directory: */
  70.   ok = DeleteFile( "RAM:NewDirectory" );
  71.  
  72.   /* Check if the directory was successfully deleted or not: */
  73.   if( ok )
  74.     printf( "Directory deleted!\n" );
  75.   else
  76.     printf( "Error! Could not delete the directory!\n" );
  77.  
  78.  
  79.  
  80.   /* The End! */
  81.   exit( 0 );
  82. }
  83.  
  84.